﻿namespace AgileZen.Models
{
    using System.Linq;
    using System.Collections.Generic;
    using System.Runtime.Serialization;
    
    [DataContract(Name = "comments")]
    public class Comments : AgileZenModel
    {
        [DataMember(Name = "items", Order = 0)]
        public ICollection<Comment> Items { get; set; }

        [DataMember(Name = "page", Order = 1)]
        public int Page { get; set; }

        [DataMember(Name = "pageSize", Order = 2)]
        public int PageSize { get; set; }

        [DataMember(Name = "totalItems", Order = 3)]
        public int TotalItems { get; set; }

        [DataMember(Name = "totalPages", Order = 4)]
        public int TotalPages { get; set; }

        public ICollection<int> CurrentOrder
        {
            get
            {
                if (Items != null)
                {
                    return (from i in Items select i.Id).ToList<int>();
                }

                return null;
            }
        }
    }
}
